package com.lucenly.card.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lucenly.card.R;
import com.lucenly.card.bean.RankBean;
import com.lucenly.card.utils.GlideUtils;
import com.lucenly.card.view.MultiImageView;

public class RankBAdapter extends BaseQuickAdapter<RankBean,BaseViewHolder> {


    public RankBAdapter() {
        super(R.layout.item_rank_b);
    }

    @Override
    protected void convert(BaseViewHolder helper, RankBean item) {
        MultiImageView iv_img = helper.getView(R.id.iv_img);
        TextView tv_name = helper.getView(R.id.tv_name);
        TextView tv_num = helper.getView(R.id.tv_num);
        TextView tv_money = helper.getView(R.id.tv_money);
        TextView tv_rank = helper.getView(R.id.tv_rank);
        ImageView iv_rank = helper.getView(R.id.iv_rank);
        GlideUtils.getInstance(mContext).load(mContext,item.avatar,iv_img,R.color.gray_de);
        tv_name.setText(item.nickname);
        tv_money.setText(item.rewardFee+"");
        tv_num.setText(item.num+"");
        if(item.rank==1){
            tv_rank.setVisibility(View.GONE);
            iv_rank.setVisibility(View.VISIBLE);
            iv_rank.setImageResource(R.mipmap.no1x);
        }else if(item.rank==2){
            tv_rank.setVisibility(View.GONE);
            iv_rank.setVisibility(View.VISIBLE);
            iv_rank.setImageResource(R.mipmap.no2x);
        }else if(item.rank==3){
            tv_rank.setVisibility(View.GONE);
            iv_rank.setVisibility(View.VISIBLE);
            iv_rank.setImageResource(R.mipmap.no3x);
        }else {
            tv_rank.setVisibility(View.VISIBLE);
            iv_rank.setVisibility(View.GONE);
            tv_rank.setText(item.rank+"");
        }
    }
}
